# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=shareenum
pkgver=48.db728dd
pkgrel=1
groups=('blackarch' 'blackarch-scanner')
pkgdesc='Tool to enumerate shares from Windows hosts.'
arch=('x86_64' 'aarch64')
url='https://github.com/CroweCybersecurity/shareenum'
license=('GPL3')
depends=('samba' 'tdb')
makedepends=('git')
source=("git+https://github.com/CroweCybersecurity/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's|/usr/local/samba/include|/usr/include/samba-4.0|' src/Makefile
  sed -i 's|/usr/local/samba/lib/private|/usr/lib/samba|' src/Makefile
}

package() {
  cd $pkgname

  cd src

  make

  install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" ../README.md
  install -Dm 644 ../LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

